package com.example.wanandroid.mapper;

import com.example.wanandroid.pojo.LoginToken;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
public interface LoginTokenMapper {
    int deleteByPrimaryKey(Long id);

    int insert(LoginToken record);

    int insertSelective(LoginToken record);

    LoginToken selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(LoginToken record);

    int updateByPrimaryKey(LoginToken record);

    @Select("SELECT id,user_id AS userId,expired_date AS expiredDate,token FROM tb_token where token = #{token} order by id desc limit 1")
    LoginToken selectByToken(String token);

    @Delete("delete from tb_token where token = #{token}")
    int deleteByToken(String token);


}